package chixing.day04;

public class Account {

    private String accNo;
    private String accName;
    private String accPassword;
    private String accTelno;
    private double accBalance;
    private int accType;

    public void setAccNo(String accNo) {
        this.accNo = accNo;
    }
    public String getAccNo() {
        return this.accNo;
    }
    public void setAccName(String accName) {
        this.accName = accName;
    }
    public String getAccName() {
        return this.accName;
    }
    public void setAccPassword(String accPassword) {
        this.accPassword = accPassword;
    }
    public String getAccPassword() {
        return this.accPassword;
    }
    public void setAccTelno(String accTelno) {
        this.accTelno = accTelno;
    }
    public String getAccTelno() {
        return this.accTelno;
    }
    public void setAccBalance(double accBalance) {
        this.accBalance = accBalance;
    }
    public double getAccBalance() {
        return this.accBalance;
    }
    public void setaccType(int accType){
        this.accType = accType;
    }
    public int getaccType(){
        return this.accType;
    }
    public String toString() {
        return "账号：" + accNo + "  姓名：" + accName + "  手机号：" + accTelno + "  余额：" + accBalance + "  账户类型：" + accType;
    }
    public static void deposit(Account account, double money) {
        account.setAccBalance(account.getAccBalance() + money);
        System.out.println("账户余额为：" + account.getAccBalance());
    }
    public static void withdraw(Account account, double money) {
        if (account.getAccBalance() >= money) {
            account.setAccBalance(account.getAccBalance() - money);
            System.out.println("取款成功，账户余额为：" + account.getAccBalance());
        } else {
            System.out.println("取款失败，账户余额不足");
        }
    }
}
